set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[up_SearchPatient]
	-- Add the parameters for the stored procedure here
	@EGN nvarchar,
	@Name nvarchar,
	@LastName nvarchar
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	IF @EGN IS NULL SELECT @EGN ='';
	IF @Name IS NULL SELECT @Name ='';
	IF @LastName IS NULL SELECT @LastName ='';
	select * from patients 
where EGN like @EGN +'%' AND NAME LIKE @Name +'%' AND LastName LIKE @LastName +'%'
END


